﻿<div class="row">
    <div class="col-xs-12 col-md-12 col-lg-12">
        <div class="widget">
            <div class="widget-header bg-blue">
            	<i class="widget-icon fa fa-arrow-left"></i>
                <span class="widget-caption">关键词回复</span>
                <div class="widget-buttons">
                    <a href="#" data-toggle="maximize">
                        <i class="fa fa-expand"></i>
                    </a>
                    <a href="#" data-toggle="collapse">
                        <i class="fa fa-minus"></i>
                    </a>
                    <a href="#" data-toggle="dispose">
                        <i class="fa fa-times"></i>
                    </a>
                </div>
            </div>
            <div class="widget-body" style="height: auto;">
            	
            	
				<!--  -->
            	<div class="widget-main ">
                    <div class="tabbable">
                        <ul class="nav nav-tabs tabs-flat" id="myTab11">
                            <li class="active">
                                <a data-toggle="tab" href="#client">
                                	客户
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#business">
                                	商户
                                </a>
                            </li>
                            <li>
                                <a data-toggle="tab" href="#auntie">
                                	社区管家
                                </a>
                            </li>
                        </ul>
                        <div class="tab-content tabs-flat">
                            <div id="client" class="tab-pane active">
                                <!-- 客户 -->
                                
                                <div class="table-toolbar">
									<a href="{:U('Admin/Wx/keyword_set',array('wx_id'=>1))}" class="btn btn-primary" data-loader="bb-loader" data-loadername="设置自定义菜单">
										<i class="fa fa-plus"></i>新增关键词
									</a>
									<!--<a id="bb-delall" class="btn btn-danger" href="javascript:void(0);">
										<i class="fa fa-times"></i> 批量删除关键词
									</a>-->
								</div>
								<table class="table table-hover table-striped table-bordered">
				                    <thead class="bordered-blueberry">
				                        <tr role="row">
				                        	<th style="width: 30px;">
				                        		<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
													<label style="padding-left: 4px;"> <input type="checkbox" class="bb-checkall colored-blue">
				                                     <span class="text"></span>
													</label>                                    
				                                </div>
				                        	</th>
				                        	<th>id</th>
				                        	<th>触发关键词</th>
				                        	<th>类型</th>
				                        	<th>内容</th>
				                        	<th style="width: 160px">操作</th>
				                        </tr>
				                    </thead>
				                    <tbody>
				                    	<volist name="keyword1" id="vo">
				                    		<tr>
				                    			<td>
													<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
														<label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue bb-check" value="{$vo.id}">
					                                     <span class="text"></span>
														</label>                                    
					                                </div>
												</td>
				                    			<td>{$vo.id}</td>
				                    			<td>{$vo.keyword}</td>
				                    			<td>{$vo.type}</td>
				                    			<td>{$vo.content}</td>
				                    			<td align="center">
				                        			<a href="{:U('Admin/Wx/keyword_set',array('id'=>$vo['id'],'wx_id'=>1))}" data-loader="bb-loader" data-loadername="修改自定义菜单" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> 修改</a>
				                        			<a href="#" class="btn btn-danger btn-xs delete" data-id="{$vo.id}"><i class="fa fa-trash-o"></i> 删除</a>
				                        		</td>
				                    		</tr>
				                    	</volist>
				                    </tbody>
				                </table>
				                <div class="row DTTTFooter">{$page1}</div>
                                <!-- 客户 -->
                            </div>

                            <div id="business" class="tab-pane">
                                <!-- 商户 -->
                                <div class="table-toolbar">
									<a href="{:U('Admin/Wx/keyword_set',array('wx_id'=>2))}" class="btn btn-primary" data-loader="bb-loader" data-loadername="设置自定义菜单">
										<i class="fa fa-plus"></i>新增关键词
									</a>
									<!--<a id="bb-delall" class="btn btn-danger" href="javascript:void(0);">
										<i class="fa fa-times"></i> 批量删除关键词
									</a>-->
								</div>
								<table class="table table-hover table-striped table-bordered">
				                    <thead class="bordered-blueberry">
				                        <tr role="row">
				                        	<th style="width: 30px;">
				                        		<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
													<label style="padding-left: 4px;"> <input type="checkbox" class="bb-checkall colored-blue">
				                                     <span class="text"></span>
													</label>                                    
				                                </div>
				                        	</th>
				                        	<th>id</th>
				                        	<th>触发关键词</th>
				                        	<th>类型</th>
				                        	<th>内容</th>
				                        	<th style="width: 160px">操作</th>
				                        </tr>
				                    </thead>
				                    <tbody>
				                    	<volist name="keyword2" id="vo">
				                    		<tr>
				                    			<td>
													<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
														<label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue bb-check" value="{$vo.id}">
					                                     <span class="text"></span>
														</label>                                    
					                                </div>
												</td>
				                    			<td>{$vo.id}</td>
				                    			<td>{$vo.keyword}</td>
				                    			<td>{$vo.type}</td>
				                    			<td>{$vo.content}</td>
				                    			<td align="center">
				                        			<a href="{:U('Admin/Wx/keyword_set',array('id'=>$vo['id'],'wx_id'=>2))}" data-loader="bb-loader" data-loadername="修改自定义菜单" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> 修改</a>
				                        			<a href="#" class="btn btn-danger btn-xs delete" data-id="{$vo.id}"><i class="fa fa-trash-o"></i> 删除</a>
				                        		</td>
				                    		</tr>
				                    	</volist>
				                    </tbody>
				                </table>
				                <div class="row DTTTFooter">{$page2}</div>
                            	<!-- 商户 -->
                            </div>
                            
                            <div id="auntie" class="tab-pane">
								<!-- 阿姨 -->
								<div class="table-toolbar">
									<a href="{:U('Admin/Wx/keyword_set',array('wx_id'=>3))}" class="btn btn-primary" data-loader="bb-loader" data-loadername="设置自定义菜单">
										<i class="fa fa-plus"></i>新增关键词
									</a>
									<!--<a id="bb-delall" class="btn btn-danger" href="javascript:void(0);">
										<i class="fa fa-times"></i> 批量删除关键词
									</a>-->
								</div>
								<table class="table table-hover table-striped table-bordered">
				                    <thead class="bordered-blueberry">
				                        <tr role="row">
				                        	<th style="width: 30px;">
				                        		<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
													<label style="padding-left: 4px;"> <input type="checkbox" class="bb-checkall colored-blue">
				                                     <span class="text"></span>
													</label>                                    
				                                </div>
				                        	</th>
				                        	<th>id</th>
				                        	<th>触发关键词</th>
				                        	<th>类型</th>
				                        	<th>内容</th>
				                        	<th style="width: 160px">操作</th>
				                        </tr>
				                    </thead>
				                    <tbody>
				                    	<volist name="keyword3" id="vo">
				                    		<tr>
				                    			<td>
													<div class="checkbox" style="margin-bottom: 0px; margin-top: 0px;">
														<label style="padding-left: 4px;"> <input name="checkvalue" type="checkbox" class="colored-blue bb-check" value="{$vo.id}">
					                                     <span class="text"></span>
														</label>                                    
					                                </div>
												</td>
				                    			<td>{$vo.id}</td>
				                    			<td>{$vo.keyword}</td>
				                    			<td>{$vo.type}</td>
				                    			<td>{$vo.content}</td>
				                    			<td align="center">
				                        			<a href="{:U('Admin/Wx/keyword_set',array('id'=>$vo['id'],'wx_id'=>3))}" data-loader="bb-loader" data-loadername="修改自定义菜单" class="btn btn-info btn-xs edit"><i class="fa fa-edit"></i> 修改</a>
				                        			<a href="#" class="btn btn-danger btn-xs delete" data-id="{$vo.id}"><i class="fa fa-trash-o"></i> 删除</a>
				                        		</td>
				                    		</tr>
				                    	</volist>
				                    </tbody>
				                </table>
				                <div class="row DTTTFooter">{$page3}</div>
								<!-- 阿姨 -->
                            </div>
						</div>
					</div>
               </div>
               <!-- -->
            </div>
        </div>
    </div>
</div>

<!--面包屑导航封装-->
<div id="tmpbread" style="display: none;">{$breadhtml}</div>
<script type="text/javascript">
	setBread($('#tmpbread').html());
</script>

<script type="text/javascript">
	//全选
	var checkall=$('.bb-checkall');
	var checks=$('.bb-check');
	var trs=$('table tbody tr');
	$(checkall).on('click',function(){
		if($(this).is(":checked")){			
			$(checks).prop("checked","checked");
		}else{
			$(checks).removeAttr("checked");
		}		
	});
	$(trs).on('click',function(){
		var c=$(this).find("input[type=checkbox]");
		if($(c).is(":checked")){
			$(c).removeAttr("checked");
		}else{
			$(c).prop("checked","checked");
		}		
	});
	//多选删
	$('#bb-delall').on('click',function(){
		var checks=$(".bb-check:checked");
		var chk='';
		$(checks).each(function(){
			chk+=$(this).val()+',';
		});
		if(!chk){
			$.bb.alert('danger','请选择要删除的项目！');
			return false;
		}
		var toajax="{:U('Admin/Wx/keyword_del')}";
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.bb.ajax('post',toajax,{'id':chk},callok,callerr);
		}						
		$.bb.confirm("确认要删除吗？",funok);
	});
	//单独删除
	$('.delete').on('click',function(){
		var id=$(this).data('id');
		var toajax="{:U('Admin/Wx/keyword_del')}";
		var funok=function(){
			var callok=function(){
				//成功删除后刷新
				$('#refresh-toggler').trigger('click');
				return false;
			};
			var callerr=function(){
				//拦截错误
				return false;
			};
			$.bb.ajax('post',toajax,{'id':id},callok,callerr);
		}						
		$.bb.confirm("确认要删除吗？",funok);
	})
</script>